/*
 * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_STATUS_RECEIVER_INTERFACE_H
#define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_STATUS_RECEIVER_INTERFACE_H

#include "iremote_broker.h"

namespace OHOS {
namespace AppExecFwk {
class IStatusReceiver : public IRemoteBroker {
public:
    DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.StatusReceiver");

    /**
     * @brief Called when install status changed, with the percentage of installation progress
     * @param progress Indicates the percentage of the installation progress.
     */
    virtual void OnStatusNotify(const int progress) = 0;
    /**
     * @brief Called when an application is installed, updated, or uninstalled.
     * @param resultCode Indicates the status code returned for the application installation, update, or uninstallation
     *                   result.
     * @param resultMsg Indicates the result message returned with the status code.
     */
    virtual void OnFinished(const int32_t resultCode, const std::string &resultMsg) = 0;

    virtual void SetStreamInstallId(uint32_t installerId) = 0;

    enum {
        SUCCESS = 0,
        ERR_INSTALL_INTERNAL_ERROR = 9568260,
        ERR_INSTALL_HOST_INSTALLER_FAILED = 9568261,
        ERR_INSTALL_PARSE_FAILED = 9568262,
        ERR_INSTALL_VERSION_DOWNGRADE = 9568263,
        ERR_INSTALL_VERIFICATION_FAILED = 9568264,
        ERR_INSTALL_PARAM_ERROR = 9568265,
        ERR_INSTALL_PERMISSION_DENIED = 9568266,
        ERR_INSTALL_ENTRY_ALREADY_EXIST = 9568267,
        ERR_INSTALL_STATE_ERROR = 9568268,
        ERR_INSTALL_FILE_PATH_INVALID = 9568269,
        ERR_INSTALL_INVALID_HAP_NAME = 9568270,
        ERR_INSTALL_INVALID_BUNDLE_FILE = 9568271,
        ERR_INSTALL_INVALID_HAP_SIZE = 9568272,
        ERR_INSTALL_GENERATE_UID_ERROR = 9568273,
        ERR_INSTALL_INSTALLD_SERVICE_ERROR = 9568274,
        ERR_INSTALL_BUNDLE_MGR_SERVICE_ERROR = 9568275,
        ERR_INSTALL_ALREADY_EXIST = 9568276,
        ERR_INSTALL_BUNDLENAME_NOT_SAME = 9568277,
        ERR_INSTALL_VERSIONCODE_NOT_SAME = 9568278,
        ERR_INSTALL_VERSIONNAME_NOT_SAME = 9568279,
        ERR_INSTALL_MINCOMPATIBLE_VERSIONCODE_NOT_SAME = 9568280,
        ERR_INSTALL_VENDOR_NOT_SAME = 9568281,
        ERR_INSTALL_RELEASETYPE_TARGET_NOT_SAME = 9568282,
        ERR_INSTALL_RELEASETYPE_NOT_SAME = 9568258,
        ERR_INSTALL_RELEASETYPE_COMPATIBLE_NOT_SAME = 9568283,
        ERR_INSTALL_VERSION_NOT_COMPATIBLE = 9568284,
        ERR_INSTALL_APP_DISTRIBUTION_TYPE_NOT_SAME = 9568285,
        ERR_INSTALL_APP_PROVISION_TYPE_NOT_SAME = 9568286,
        ERR_INSTALL_INVALID_NUMBER_OF_ENTRY_HAP = 9568287,
        ERR_INSTALL_DISK_MEM_INSUFFICIENT = 9568288,
        ERR_INSTALL_GRANT_REQUEST_PERMISSIONS_FAILED = 9568289,
        ERR_INSTALL_UPDATE_HAP_TOKEN_FAILED = 9568290,
        ERR_INSTALL_SINGLETON_NOT_SAME = 9568291,
        ERR_INSTALL_ZERO_USER_WITH_NO_SINGLETON = 9568292,
        ERR_INSTALL_CHECK_SYSCAP_FAILED = 9568293,
        ERR_INSTALL_APPTYPE_NOT_SAME = 9568294,
        ERR_INSTALL_URI_DUPLICATE = 9568295,
        ERR_INSTALL_TYPE_ERROR = 9568296,
        ERR_INSTALL_SDK_INCOMPATIBLE = 9568297,
        ERR_INSTALL_SO_INCOMPATIBLE = 9568298,
        ERR_INSTALL_AN_INCOMPATIBLE = 9568299,
        ERR_INSTALL_NOT_UNIQUE_DISTRO_MODULE_NAME = 9568300,
        ERR_INSTALL_INCONSISTENT_MODULE_NAME = 9568301,
        ERR_INSTALL_SINGLETON_INCOMPATIBLE = 9568302,
        ERR_INSTALL_DISALLOWED = 9568303,
        ERR_INSTALL_DEVICE_TYPE_NOT_SUPPORTED = 9568304,
        ERR_INSTALL_DEPENDENT_MODULE_NOT_EXIST = 9568305,
        ERR_INSTALL_ASAN_ENABLED_NOT_SAME = 9568306,
        ERR_INSTALL_ASAN_ENABLED_NOT_SUPPORT = 9568307,
        ERR_INSTALL_BUNDLE_TYPE_NOT_SAME = 9568308,
        ERR_INSTALL_SHARE_APP_LIBRARY_NOT_ALLOWED = 9568309,
        ERR_INSTALL_COMPATIBLE_POLICY_NOT_SAME = 9568310,
        ERR_APPEXECFWK_UNINSTALL_SHARE_APP_LIBRARY_IS_NOT_EXIST = 9568311,
        ERR_APPEXECFWK_UNINSTALL_SHARE_APP_LIBRARY_IS_RELIED = 9568312,
        ERR_APPEXECFWK_UNINSTALL_BUNDLE_IS_SHARED_LIBRARY = 9568313,
        ERR_INSTALL_FILE_IS_SHARED_LIBRARY = 9568314,
        ERR_INSATLL_CHECK_PROXY_DATA_URI_FAILED = 9568315,
        ERR_INSATLL_CHECK_PROXY_DATA_PERMISSION_FAILED = 9568316,
        ERR_INSTALL_ISOLATION_MODE_FAILED = 9568317,

        // signature errcode
        ERR_INSTALL_FAILED_INVALID_SIGNATURE_FILE_PATH = 9568318,
        ERR_INSTALL_FAILED_BAD_BUNDLE_SIGNATURE_FILE = 9568319,
        ERR_INSTALL_FAILED_NO_BUNDLE_SIGNATURE = 9568320,
        ERR_INSTALL_FAILED_VERIFY_APP_PKCS7_FAIL = 9568257,
        ERR_INSTALL_FAILED_PROFILE_PARSE_FAIL = 9568321,
        ERR_INSTALL_FAILED_APP_SOURCE_NOT_TRUESTED = 9568322,
        ERR_INSTALL_FAILED_BAD_DIGEST = 9568323,
        ERR_INSTALL_FAILED_BUNDLE_INTEGRITY_VERIFICATION_FAILURE = 9568324,
        ERR_INSTALL_FAILED_FILE_SIZE_TOO_LARGE = 9568325,
        ERR_INSTALL_FAILED_BAD_PUBLICKEY = 9568326,
        ERR_INSTALL_FAILED_BAD_BUNDLE_SIGNATURE = 9568327,
        ERR_INSTALL_FAILED_NO_PROFILE_BLOCK_FAIL = 9568328,
        ERR_INSTALL_FAILED_BUNDLE_SIGNATURE_VERIFICATION_FAILURE = 9568329,
        ERR_INSTALL_FAILED_VERIFY_SOURCE_INIT_FAIL = 9568330,
        ERR_INSTALL_FAILED_INCOMPATIBLE_SIGNATURE = 9568331,
        ERR_INSTALL_FAILED_INCONSISTENT_SIGNATURE = 9568332,
        ERR_INSTALL_FAILED_MODULE_NAME_EMPTY = 9568333,
        ERR_INSTALL_FAILED_MODULE_NAME_DUPLICATE = 9568334,
        ERR_INSTALL_FAILED_CHECK_HAP_HASH_PARAM = 9568335,
        ERR_INSTALL_FAILED_DEBUG_NOT_SAME = 9568336,

        ERR_INSTALL_PARSE_UNEXPECTED = 9568337,
        ERR_INSTALL_PARSE_MISSING_BUNDLE = 9568338,
        ERR_INSTALL_PARSE_MISSING_ABILITY = 9568339,
        ERR_INSTALL_PARSE_NO_PROFILE = 9568340,
        ERR_INSTALL_PARSE_BAD_PROFILE = 9568341,
        ERR_INSTALL_PARSE_PROFILE_PROP_TYPE_ERROR = 9568342,
        ERR_INSTALL_PARSE_PROFILE_MISSING_PROP = 9568259,
        ERR_INSTALL_PARSE_PERMISSION_ERROR = 9568343,
        ERR_INSTALL_PARSE_PROFILE_PROP_CHECK_ERROR = 9568344,
        ERR_INSTALL_PARSE_PROFILE_PROP_SIZE_CHECK_ERROR = 9568345,
        ERR_INSTALL_PARSE_RPCID_FAILED = 9568346,
        ERR_INSTALL_PARSE_NATIVE_SO_FAILED = 9568347,
        ERR_INSTALL_PARSE_AN_FAILED = 9568348,

        ERR_INSTALLD_PARAM_ERROR = 9568349,
        ERR_INSTALLD_GET_PROXY_ERROR = 9568350,
        ERR_INSTALLD_CREATE_DIR_FAILED = 9568351,
        ERR_INSTALLD_CREATE_DIR_EXIST = 9568352,
        ERR_INSTALLD_CHOWN_FAILED = 9568353,
        ERR_INSTALLD_REMOVE_DIR_FAILED = 9568354,
        ERR_INSTALLD_EXTRACT_FILES_FAILED = 9568355,
        ERR_INSTALLD_RNAME_DIR_FAILED = 9568356,
        ERR_INSTALLD_CLEAN_DIR_FAILED = 9568357,
        ERR_INSTALLD_PERMISSION_DENIED = 9568358,
        ERR_INSTALLD_SET_SELINUX_LABEL_FAILED = 9568359,

        // overlay installation
        ERR_OVERLAY_INSTALLATION_FAILED_INTERNAL_ERROR = 9568360,
        ERR_OVERLAY_INSTALLATION_FAILED_INVALID_BUNDLE_NAME = 9568361,
        ERR_OVERLAY_INSTALLATION_FAILED_INVALID_MODULE_NAME = 9568362,
        ERR_OVERLAY_INSTALLATION_FAILED_ERROR_HAP_TYPE = 9568363,
        ERR_OVERLAY_INSTALLATION_FAILED_ERROR_BUNDLE_TYPE = 9568364,
        ERR_OVERLAY_INSTALLATION_FAILED_TARGET_BUNDLE_NAME_MISSED = 9568365,
        ERR_OVERLAY_INSTALLATION_FAILED_TARGET_MODULE_NAME_MISSED = 9568366,
        ERR_OVERLAY_INSTALLATION_FAILED_TARGET_BUNDLE_NAME_NOT_SAME = 9568367,
        ERR_OVERLAY_INSTALLATION_FAILED_INTERNAL_EXTERNAL_OVERLAY_EXISTED_SIMULTANEOUSLY = 9568368,
        ERR_OVERLAY_INSTALLATION_FAILED_TARGET_PRIORITY_NOT_SAME = 9568369,
        ERR_OVERLAY_INSTALLATION_FAILED_INVALID_PRIORITY = 9568370,
        ERR_OVERLAY_INSTALLATION_FAILED_INCONSISTENT_VERSION_CODE = 9568371,
        ERR_OVERLAY_INSTALLATION_FAILED_SERVICE_EXCEPTION = 9568372,
        ERR_OVERLAY_INSTALLATION_FAILED_BUNDLE_NAME_SAME_WITH_TARGET_BUNDLE_NAME = 9568373,
        ERR_OVERLAY_INSTALLATION_FAILED_NO_SYSTEM_APPLICATION_FOR_EXTERNAL_OVERLAY = 9568374,
        ERR_OVERLAY_INSTALLATION_FAILED_DIFFERENT_SIGNATURE_CERTIFICATE = 9568375,
        ERR_OVERLAY_INSTALLATION_FAILED_TARGET_BUNDLE_IS_OVERLAY_BUNDLE = 9568376,
        ERR_OVERLAY_INSTALLATION_FAILED_TARGET_MODULE_IS_OVERLAY_MODULE = 9568377,
        ERR_OVERLAY_INSTALLATION_FAILED_OVERLAY_TYPE_NOT_SAME = 9568378,
        ERR_OVERLAY_INSTALLATION_FAILED_INVALID_BUNDLE_DIR = 9568379,

        ERR_UNINSTALL_SYSTEM_APP_ERROR = 9568380,
        ERR_UNINSTALL_KILLING_APP_ERROR = 9568381,
        ERR_UNINSTALL_INVALID_NAME = 9568382,
        ERR_UNINSTALL_PARAM_ERROR = 9568383,
        ERR_UNINSTALL_PERMISSION_DENIED = 9568384,
        ERR_UNINSTALL_BUNDLE_MGR_SERVICE_ERROR = 9568385,
        ERR_UNINSTALL_MISSING_INSTALLED_BUNDLE = 9568386,
        ERR_UNINSTALL_MISSING_INSTALLED_MODULE = 9568387,
        ERR_UNINSTALL_DISALLOWED = 9568388,
        ERR_UNKNOWN = 9568389,

        ERR_FAILED_GET_INSTALLER_PROXY = 9568390,
        ERR_FAILED_SERVICE_DIED = 9568391,
        ERR_OPERATION_TIME_OUT = 9568392,

        ERR_INSTALL_CODE_SIGNATURE_FAILED = 9568393,
        ERR_INSTALL_CODE_SIGNATURE_FILE_IS_INVALID = 9568394,

        ERR_UNINSTALL_FROM_BMS_EXTENSION_FAILED = 9568395,

        ERR_INSTALL_SELF_UPDATE_NOT_MDM = 9568396,
        ERR_INSTALL_SELF_UPDATE_BUNDLENAME_NOT_SAME = 9568397,
        ERR_INSTALL_ENTERPRISE_BUNDLE_NOT_ALLOWED = 9568398,
        ERR_INSTALLD_COPY_FILE_FAILED = 9568399,
        ERR_INSTALL_GWP_ASAN_ENABLED_NOT_SAME = 9568400,
        ERR_INSTALL_DEBUG_BUNDLE_NOT_ALLOWED = 9568401,
        ERR_INSTALL_CHECK_ENCRYPTION_FAILED = 9568403,
        ERR_INSTALL_CODE_SIGNATURE_DELIVERY_FILE_FAILED = 9568404,
        ERR_INSTALL_CODE_SIGNATURE_REMOVE_FILE_FAILED = 9568405,
        ERR_UNINSTALL_AND_RECOVER_NOT_PREINSTALLED_BUNDLE = 9568406,
        
        // native bundle
        ERR_INSTALL_NATIVE_FAILED = 9568407,
        ERR_UNINSTALL_NATIVE_FAILED = 9568408,
        ERR_NATIVE_HNP_EXTRACT_FAILED = 9568409,

        ERR_INSTALL_CODE_APP_CONTROLLED_FAILED = 9568410,
        ERR_UNINSTALL_CONTROLLED = 9568412,
        // install bundle
        ERR_INSTALL_CHECK_SYSCAP_FAILED_AND_DEVICE_TYPE_NOT_SUPPORTED = 9568413,

        ERR_INSTALL_EXISTED_ENTERPRISE_BUNDLE_NOT_ALLOWED = 9568414,

        ERR_RECOVER_GET_BUNDLEPATH_ERROR = 201,
        ERR_RECOVER_INVALID_BUNDLE_NAME,
        ERR_RECOVER_NOT_ALLOWED,

        ERR_USER_NOT_EXIST = 301,
        ERR_USER_CREATE_FAILED,
        ERR_USER_REMOVE_FAILED,
        ERR_USER_NOT_INSTALL_HAP,
    };
};
}  // namespace AppExecFwk
}  // namespace OHOS
#endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_BUNDLEMGR_STATUS_RECEIVER_INTERFACE_H